feat: Support OIDC Provider OIDC Clients#2147
Conversation
8c8fa7f to
7e15537
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Terraform resource to manage Rancher OIDC clients (CRUD) and registers it with the provider.
Changes:
- Introduces
rancher2_oidc_clientresource implementation (schema + CRUD). - Adds unit tests for expand/flatten helpers.
- Registers the new resource in
Provider()resources map.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
rancher2/resource_rancher2_oidc_client.go |
New OIDC client resource schema + CRUD + expand/flatten helpers. |
rancher2/resource_rancher2_oidc_client_test.go |
Unit tests for expand/flatten behavior. |
rancher2/provider.go |
Registers the new rancher2_oidc_client resource. |
7e15537 to
7b87e5c
Compare
7b87e5c to
4d388e7
Compare
4d388e7 to
dee3e92
Compare
dee3e92 to
478a5ef
Compare
367aae4 to
ed00cc1
Compare
fb5d2b4 to
52dff94
Compare
JonCrowther
left a comment
There was a problem hiding this comment.
LGTM with just one nit related to the logging
140e5f0 to
493535e
Compare
This adds support for the OIDC Provider OIDCClient resource.
493535e to
5367660
Compare
| # rancher2\_oidc_client Resource | ||
|
|
||
| Provides a Rancher OIDC Client. This can be used to configure the OIDC Clients | ||
| available for the Rancher OIDC Provider. |
There was a problem hiding this comment.
Probably an auto-wrap for line length
| available for the Rancher OIDC Provider. | |
| Provides a Rancher OIDC Client. This can be used to configure the OIDC Clients available for the Rancher OIDC Provider. |
| ### Creating a Rancher OIDC Client. | ||
|
|
||
| ```hcl | ||
| resource "rancher2_oidc_client" "oidc-test-client" { | ||
| description = "Access for Test Client" |
There was a problem hiding this comment.
We should adhere to the same structure/conventions: https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/user#example-usage
| ### Creating a Rancher OIDC Client. | |
| ```hcl | |
| resource "rancher2_oidc_client" "oidc-test-client" { | |
| description = "Access for Test Client" | |
| ```hcl | |
| # Create a new rancher2 OIDC Client | |
| resource "rancher2_oidc_client" "foo" { | |
| description = "Foo OIDC Client" |
| * `description` - A human-readable description for the OIDC Client. | ||
| * `token_expiration_seconds` - ID Token and Access Token will only be valid for this many seconds. | ||
| * `refresh_token_expiration_seconds` - How long can the refresh token be used for? | ||
| * `redirect_uris` - Provides a list of allowed redirect URIs for this OIDC Client. |
There was a problem hiding this comment.
Maybe it's clearer to put before the required args, also specifying if they are required/optional?
| * `description` - A human-readable description for the OIDC Client. | |
| * `token_expiration_seconds` - ID Token and Access Token will only be valid for this many seconds. | |
| * `refresh_token_expiration_seconds` - How long can the refresh token be used for? | |
| * `redirect_uris` - Provides a list of allowed redirect URIs for this OIDC Client. | |
| * `redirect_uris` - (Required) List of allowed redirect URIs for this OIDC Client (list) | |
| * `description` - (Optional) A human-readable description for the OIDC Client (string) | |
| * `token_expiration_seconds` - (Optional/Computed) ID Token and Access Token will only be valid for this many seconds (int) | |
| * `refresh_token_expiration_seconds` - (Optional/Computed) How long can the refresh token be used for (int) |
| OIDC Clients can be imported using the Client name in the format `<client_name>` | ||
|
|
||
| ``` | ||
| $ terraform import rancher2_oidc_client.foo <CLIENT_NAME> |
There was a problem hiding this comment.
| $ terraform import rancher2_oidc_client.foo <CLIENT_NAME> | |
| $ terraform import rancher2_oidc_client.foo <client_name> |
enrichman
left a comment
There was a problem hiding this comment.
Just some comments related to the docs, but LGTM 🙂
Addresses #2156 and rancher/rancher#53639
Description
Adds support for CRUDding OIDCClients
Testing
Not a breaking change.